\(\int \frac {\tan ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx\) [307]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [C] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 83 \[ \int \frac {\tan ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {b B x}{a^2+b^2}+\frac {a B \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}-\frac {a^3 B \log (a+b \tan (c+d x))}{b^2 \left (a^2+b^2\right ) d}+\frac {B \tan (c+d x)}{b d} \]

[Out]

-b*B*x/(a^2+b^2)+a*B*ln(cos(d*x+c))/(a^2+b^2)/d-a^3*B*ln(a+b*tan(d*x+c))/b^2/(a^2+b^2)/d+B*tan(d*x+c)/b/d

Rubi [A] (verified)

Time = 0.18 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {21, 3647, 3707, 3698, 31, 3556} \[ \int \frac {\tan ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {a B \log (\cos (c+d x))}{d \left (a^2+b^2\right )}-\frac {b B x}{a^2+b^2}-\frac {a^3 B \log (a+b \tan (c+d x))}{b^2 d \left (a^2+b^2\right )}+\frac {B \tan (c+d x)}{b d} \]

[In]

Int[(Tan[c + d*x]^3*(a*B + b*B*Tan[c + d*x]))/(a + b*Tan[c + d*x])^2,x]

[Out]

-((b*B*x)/(a^2 + b^2)) + (a*B*Log[Cos[c + d*x]])/((a^2 + b^2)*d) - (a^3*B*Log[a + b*Tan[c + d*x]])/(b^2*(a^2 +
 b^2)*d) + (B*Tan[c + d*x])/(b*d)

Rule 21

Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> Dist[(b/d)^m, Int[u*(c + d*v)^(m +
 n), x], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c +
 d*x, a + b*x])

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3647

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Si
mp[b^2*(a + b*Tan[e + f*x])^(m - 2)*((c + d*Tan[e + f*x])^(n + 1)/(d*f*(m + n - 1))), x] + Dist[1/(d*(m + n -
1)), Int[(a + b*Tan[e + f*x])^(m - 3)*(c + d*Tan[e + f*x])^n*Simp[a^3*d*(m + n - 1) - b^2*(b*c*(m - 2) + a*d*(
1 + n)) + b*d*(m + n - 1)*(3*a^2 - b^2)*Tan[e + f*x] - b^2*(b*c*(m - 2) - a*d*(3*m + 2*n - 4))*Tan[e + f*x]^2,
 x], x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0]
&& IntegerQ[2*m] && GtQ[m, 2] && (GeQ[n, -1] || IntegerQ[m]) &&  !(IGtQ[n, 2] && ( !IntegerQ[m] || (EqQ[c, 0]
&& NeQ[a, 0])))

Rule 3698

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[
A/(b*f), Subst[Int[(a + x)^m, x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]

Rule 3707

Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2)/((a_.) + (b_.)*tan[(e_.) + (f_.)*
(x_)]), x_Symbol] :> Simp[(a*A + b*B - a*C)*(x/(a^2 + b^2)), x] + (Dist[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2), I
nt[(1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Dist[(A*b - a*B - b*C)/(a^2 + b^2), Int[Tan[e + f*x], x
], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a
*B - b*C, 0]

Rubi steps \begin{align*} \text {integral}& = B \int \frac {\tan ^3(c+d x)}{a+b \tan (c+d x)} \, dx \\ & = \frac {B \tan (c+d x)}{b d}+\frac {B \int \frac {-a-b \tan (c+d x)-a \tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{b} \\ & = -\frac {b B x}{a^2+b^2}+\frac {B \tan (c+d x)}{b d}-\frac {(a B) \int \tan (c+d x) \, dx}{a^2+b^2}-\frac {\left (a^3 B\right ) \int \frac {1+\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{b \left (a^2+b^2\right )} \\ & = -\frac {b B x}{a^2+b^2}+\frac {a B \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}+\frac {B \tan (c+d x)}{b d}-\frac {\left (a^3 B\right ) \text {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \tan (c+d x)\right )}{b^2 \left (a^2+b^2\right ) d} \\ & = -\frac {b B x}{a^2+b^2}+\frac {a B \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}-\frac {a^3 B \log (a+b \tan (c+d x))}{b^2 \left (a^2+b^2\right ) d}+\frac {B \tan (c+d x)}{b d} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.39 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.11 \[ \int \frac {\tan ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {B \left (\frac {\log (i-\tan (c+d x))}{a+i b}+\frac {\log (i+\tan (c+d x))}{a-i b}+\frac {2 a^3 \log (a+b \tan (c+d x))}{b^2 \left (a^2+b^2\right )}-\frac {2 \tan (c+d x)}{b}\right )}{2 d} \]

[In]

Integrate[(Tan[c + d*x]^3*(a*B + b*B*Tan[c + d*x]))/(a + b*Tan[c + d*x])^2,x]

[Out]

-1/2*(B*(Log[I - Tan[c + d*x]]/(a + I*b) + Log[I + Tan[c + d*x]]/(a - I*b) + (2*a^3*Log[a + b*Tan[c + d*x]])/(
b^2*(a^2 + b^2)) - (2*Tan[c + d*x])/b))/d

Maple [A] (verified)

Time = 0.08 (sec) , antiderivative size = 80, normalized size of antiderivative = 0.96

method result size
derivativedivides \(\frac {B \left (\frac {\tan \left (d x +c \right )}{b}+\frac {-\frac {a \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}-b \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {a^{3} \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{2} \left (a^{2}+b^{2}\right )}\right )}{d}\) \(80\)
default \(\frac {B \left (\frac {\tan \left (d x +c \right )}{b}+\frac {-\frac {a \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}-b \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}-\frac {a^{3} \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{2} \left (a^{2}+b^{2}\right )}\right )}{d}\) \(80\)
parallelrisch \(-\frac {2 B \,b^{3} d x +B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a \,b^{2}+2 B \ln \left (a +b \tan \left (d x +c \right )\right ) a^{3}-2 B \,a^{2} b \tan \left (d x +c \right )-2 B \,b^{3} \tan \left (d x +c \right )}{2 \left (a^{2}+b^{2}\right ) b^{2} d}\) \(86\)
norman \(\frac {\frac {B \left (\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {B \,a^{2}}{d \,b^{2}}-\frac {b B a x}{a^{2}+b^{2}}-\frac {b^{2} B x \tan \left (d x +c \right )}{a^{2}+b^{2}}}{a +b \tan \left (d x +c \right )}-\frac {B a \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \left (a^{2}+b^{2}\right )}-\frac {a^{3} B \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{2} \left (a^{2}+b^{2}\right ) d}\) \(137\)
risch \(-\frac {i x B}{i b -a}-\frac {2 i a B x}{b^{2}}-\frac {2 i B a c}{b^{2} d}+\frac {2 i a^{3} B x}{b^{2} \left (a^{2}+b^{2}\right )}+\frac {2 i a^{3} B c}{d \left (a^{2}+b^{2}\right ) b^{2}}+\frac {2 i B}{d b \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B a}{b^{2} d}-\frac {a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B}{d \left (a^{2}+b^{2}\right ) b^{2}}\) \(175\)

[In]

int(tan(d*x+c)^3*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*B*(tan(d*x+c)/b+1/(a^2+b^2)*(-1/2*a*ln(1+tan(d*x+c)^2)-b*arctan(tan(d*x+c)))-1/b^2*a^3/(a^2+b^2)*ln(a+b*ta
n(d*x+c)))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.43 \[ \int \frac {\tan ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {2 \, B b^{3} d x + B a^{3} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - {\left (B a^{3} + B a b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) - 2 \, {\left (B a^{2} b + B b^{3}\right )} \tan \left (d x + c\right )}{2 \, {\left (a^{2} b^{2} + b^{4}\right )} d} \]

[In]

integrate(tan(d*x+c)^3*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/2*(2*B*b^3*d*x + B*a^3*log((b^2*tan(d*x + c)^2 + 2*a*b*tan(d*x + c) + a^2)/(tan(d*x + c)^2 + 1)) - (B*a^3 +
 B*a*b^2)*log(1/(tan(d*x + c)^2 + 1)) - 2*(B*a^2*b + B*b^3)*tan(d*x + c))/((a^2*b^2 + b^4)*d)

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 1.04 (sec) , antiderivative size = 660, normalized size of antiderivative = 7.95 \[ \int \frac {\tan ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\begin {cases} \tilde {\infty } B x \tan ^{2}{\left (c \right )} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {B \left (- \frac {\log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {\tan ^{2}{\left (c + d x \right )}}{2 d}\right )}{a} & \text {for}\: b = 0 \\- \frac {3 B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {3 i B d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {i B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {2 B \tan ^{2}{\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {2 i B \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {5 B}{2 b d \tan {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = - i b \\- \frac {3 B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {3 i B d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {i B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {B \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {2 B \tan ^{2}{\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {2 i B \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {5 B}{2 b d \tan {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = i b \\\frac {x \left (B a + B b \tan {\left (c \right )}\right ) \tan ^{3}{\left (c \right )}}{\left (a + b \tan {\left (c \right )}\right )^{2}} & \text {for}\: d = 0 \\- \frac {2 B a^{3} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{2} b^{2} d + 2 b^{4} d} + \frac {2 B a^{2} b \tan {\left (c + d x \right )}}{2 a^{2} b^{2} d + 2 b^{4} d} - \frac {B a b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} b^{2} d + 2 b^{4} d} - \frac {2 B b^{3} d x}{2 a^{2} b^{2} d + 2 b^{4} d} + \frac {2 B b^{3} \tan {\left (c + d x \right )}}{2 a^{2} b^{2} d + 2 b^{4} d} & \text {otherwise} \end {cases} \]

[In]

integrate(tan(d*x+c)**3*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))**2,x)

[Out]

Piecewise((zoo*B*x*tan(c)**2, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), (B*(-log(tan(c + d*x)**2 + 1)/(2*d) + tan(c + d
*x)**2/(2*d))/a, Eq(b, 0)), (-3*B*d*x*tan(c + d*x)/(2*b*d*tan(c + d*x) - 2*I*b*d) + 3*I*B*d*x/(2*b*d*tan(c + d
*x) - 2*I*b*d) + I*B*log(tan(c + d*x)**2 + 1)*tan(c + d*x)/(2*b*d*tan(c + d*x) - 2*I*b*d) + B*log(tan(c + d*x)
**2 + 1)/(2*b*d*tan(c + d*x) - 2*I*b*d) + 2*B*tan(c + d*x)**2/(2*b*d*tan(c + d*x) - 2*I*b*d) + 2*I*B*tan(c + d
*x)/(2*b*d*tan(c + d*x) - 2*I*b*d) + 5*B/(2*b*d*tan(c + d*x) - 2*I*b*d), Eq(a, -I*b)), (-3*B*d*x*tan(c + d*x)/
(2*b*d*tan(c + d*x) + 2*I*b*d) - 3*I*B*d*x/(2*b*d*tan(c + d*x) + 2*I*b*d) - I*B*log(tan(c + d*x)**2 + 1)*tan(c
 + d*x)/(2*b*d*tan(c + d*x) + 2*I*b*d) + B*log(tan(c + d*x)**2 + 1)/(2*b*d*tan(c + d*x) + 2*I*b*d) + 2*B*tan(c
 + d*x)**2/(2*b*d*tan(c + d*x) + 2*I*b*d) - 2*I*B*tan(c + d*x)/(2*b*d*tan(c + d*x) + 2*I*b*d) + 5*B/(2*b*d*tan
(c + d*x) + 2*I*b*d), Eq(a, I*b)), (x*(B*a + B*b*tan(c))*tan(c)**3/(a + b*tan(c))**2, Eq(d, 0)), (-2*B*a**3*lo
g(a/b + tan(c + d*x))/(2*a**2*b**2*d + 2*b**4*d) + 2*B*a**2*b*tan(c + d*x)/(2*a**2*b**2*d + 2*b**4*d) - B*a*b*
*2*log(tan(c + d*x)**2 + 1)/(2*a**2*b**2*d + 2*b**4*d) - 2*B*b**3*d*x/(2*a**2*b**2*d + 2*b**4*d) + 2*B*b**3*ta
n(c + d*x)/(2*a**2*b**2*d + 2*b**4*d), True))

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 89, normalized size of antiderivative = 1.07 \[ \int \frac {\tan ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {\frac {2 \, B a^{3} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{2} b^{2} + b^{4}} + \frac {2 \, {\left (d x + c\right )} B b}{a^{2} + b^{2}} + \frac {B a \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} - \frac {2 \, B \tan \left (d x + c\right )}{b}}{2 \, d} \]

[In]

integrate(tan(d*x+c)^3*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/2*(2*B*a^3*log(b*tan(d*x + c) + a)/(a^2*b^2 + b^4) + 2*(d*x + c)*B*b/(a^2 + b^2) + B*a*log(tan(d*x + c)^2 +
 1)/(a^2 + b^2) - 2*B*tan(d*x + c)/b)/d

Giac [A] (verification not implemented)

none

Time = 0.67 (sec) , antiderivative size = 90, normalized size of antiderivative = 1.08 \[ \int \frac {\tan ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=-\frac {\frac {2 \, B a^{3} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{2} b^{2} + b^{4}} + \frac {2 \, {\left (d x + c\right )} B b}{a^{2} + b^{2}} + \frac {B a \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} - \frac {2 \, B \tan \left (d x + c\right )}{b}}{2 \, d} \]

[In]

integrate(tan(d*x+c)^3*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/2*(2*B*a^3*log(abs(b*tan(d*x + c) + a))/(a^2*b^2 + b^4) + 2*(d*x + c)*B*b/(a^2 + b^2) + B*a*log(tan(d*x + c
)^2 + 1)/(a^2 + b^2) - 2*B*tan(d*x + c)/b)/d

Mupad [B] (verification not implemented)

Time = 7.21 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.18 \[ \int \frac {\tan ^3(c+d x) (a B+b B \tan (c+d x))}{(a+b \tan (c+d x))^2} \, dx=\frac {B\,\mathrm {tan}\left (c+d\,x\right )}{b\,d}-\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,d\,\left (a-b\,1{}\mathrm {i}\right )}-\frac {B\,a^3\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{b^2\,d\,\left (a^2+b^2\right )}-\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (-b+a\,1{}\mathrm {i}\right )} \]

[In]

int((tan(c + d*x)^3*(B*a + B*b*tan(c + d*x)))/(a + b*tan(c + d*x))^2,x)

[Out]

(B*tan(c + d*x))/(b*d) - (B*log(tan(c + d*x) + 1i))/(2*d*(a - b*1i)) - (B*log(tan(c + d*x) - 1i)*1i)/(2*d*(a*1
i - b)) - (B*a^3*log(a + b*tan(c + d*x)))/(b^2*d*(a^2 + b^2))